home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD Concept 6
/
CD Concept 06.iso
/
mac
/
UTILITAIRE
/
RLaB
/
testmatrix
/
hanowa.r
< prev
next >
Wrap
Text File
|
1994-12-27
|
1KB
|
48 lines
//-------------------------------------------------------------------//
// Synopsis: hanowa: A matrix whose eigenvalues lie on a vertical
// line in the complex plane.
// Syntax: hanowa (N, d)
// Description:
// hanowa (N, d) is the N-by-N block 2x2 matrix (thus N = 2M must be even)
// [d*eye(m), -diag(1:m)
// diag(1:m), d*eye(m)]
// It has complex eigenvalues:
// lambda(k) = d +/- k*i (1 <= k <= M).
// Parameter d defaults to -1.
// Reference:
// E. Hairer, S.P. Norsett and G. Wanner, Solving Ordinary
// Differential Equations I: Nonstiff Problems, Springer-Verlag,
// Berlin, 1987. (pp. 86-87)
// This file is a translation of hanowa.m from version 2.0 of
// "The Test Matrix Toolbox for Matlab", described in Numerical
// Analysis Report No. 237, December 1993, by N. J. Higham.
//-------------------------------------------------------------------//
hanowa = function (n, d)
{
local (n, d)
if (!exist (d)) { d = -1; }
m = n/2;
if (round(m) != m)
{
error ("N must be even.");
}
A = [ d*eye(m, m), -diag(1:m);
diag(1:m), d*eye(m, m)];
return A;
};